﻿<%
Dim BCASTR_WIDTH,BCASTR_HEIGHT,BCASTR_BCASTR,BCASTR_KINSLIDESHOW
Dim Bcastr_Config
Function Bcastr_Initialize()
	Set Bcastr_Config=New TConfig
	Bcastr_Config.Load "Bcastr"
	If Bcastr_Config.Exists("BCASTR_VERSION")=False Then
		Bcastr_Config.Write "BCASTR_VERSION","1.3.2"
		Bcastr_Config.Write "BCASTR_WIDTH","220"
		Bcastr_Config.Write "BCASTR_HEIGHT","170"
		Bcastr_Config.Write "BCASTR_BCASTR","True"
		Bcastr_Config.Write "BCASTR_KINSLIDESHOW","True"
	ElseIf Bcastr_Config.Read("BCASTR_VERSION")="1.0" Then		
		Bcastr_Config.Write "BCASTR_BCASTR","True"
		Bcastr_Config.Write "BCASTR_KINSLIDESHOW","True"
		Bcastr_Config.Write "BCASTR_VERSION","1.3.2"
	ElseIf Bcastr_Config.Read("BCASTR_VERSION")<"1.3" Then
		Call DelToFile(BlogPath&"/zb_users/plugin/bcastr/savesetting.asp")
		Call DelToFile(BlogPath&"/zb_users/plugin/bcastr/setting.asp")
		Call Bcastr_CopyFiles(BlogPath &"zb_users\plugin\Bcastr\bcastr_backup.xml",BlogPath &"zb_users\plugin\Bcastr\bcastr.xml",True)
		Bcastr_Config.Write "BCASTR_VERSION","1.3.2"
	End If
	Bcastr_Config.Save
	BCASTR_WIDTH = Bcastr_Config.Read("BCASTR_WIDTH")
	BCASTR_HEIGHT = Bcastr_Config.Read("BCASTR_HEIGHT")
	BCASTR_BCASTR = CBool(Bcastr_Config.Read("BCASTR_BCASTR"))
	BCASTR_KINSLIDESHOW = CBool(Bcastr_Config.Read("BCASTR_KINSLIDESHOW"))
End Function

'注册插件
Call RegisterPlugin("Bcastr","ActivePlugin_Bcastr")

'具体的接口挂接
Function ActivePlugin_Bcastr()

End Function

Function InstallPlugin_Bcastr()
	On Error Resume Next
	If LoadFromFile(BlogPath & "zb_users/include/bcastr.asp", "utf-8")="" Then
		Call Bcastr_SaveFunctions("Bcastr","Bcastr幻灯片","divBcastr","div","首次安装，请到插件管理进行添加、编辑、删除操作更新此模块内容。")
	End If
	Call Bcastr_CopyFiles(BlogPath &"zb_users\plugin\Bcastr\bcastr_backup.xml",BlogPath &"zb_users\plugin\Bcastr\bcastr.xml",False)
	Err.Clear
End Function

Function UninstallPlugin_Bcastr()
	On Error Resume Next
	Call Bcastr_DelFunctions("Bcastr")
	Err.Clear
End Function

Function Bcastr_DelFunctions(id)
	GetFunction()
	Dim objfunction
	Set objfunction=New TFunction
	objfunction.ID=FunctionMetas.GetValue(id)
	objfunction.FileName=id
	objfunction.Del
End Function

Function Bcastr_SaveFunctions(id,name,htmlid,ftype,content)
	GetFunction()
	Dim objfunction
	Set objfunction=New TFunction
	If FunctionMetas.GetValue(id)="" Then
		objfunction.ID=0
		objfunction.Name=name
		objfunction.FileName=id
		objfunction.HtmlID=htmlid
		objfunction.Ftype=ftype
		objfunction.Order=0
		objfunction.SidebarID=0
		If Right(ZC_BLOG_VERSION,6)>121221 Then
			objfunction.ViewType="html"
			objFunction.Source="plugin_Bcastr"
		End If
		objfunction.isSystem=False
		objfunction.Content=content
		objfunction.Save
	Else
		Functions(FunctionMetas.GetValue(id)).Content=content
		Functions(FunctionMetas.GetValue(id)).Save
	End If
End Function

Function Bcastr_CopyFiles(TempSource,TempEnd,IsCover)
    Dim FSO
    Set FSO = Server.CreateObject("Scripting.FileSystemObject")
    IF FSO.FileExists(TempEnd) and IsCover=False then
		Set FSO=Nothing
		Exit Function
    End IF
    IF FSO.FileExists(TempSource) Then
		FSO.CopyFile TempSource,TempEnd
		Set FSO = Nothing
    Else
		Set FSO=Nothing
		Exit Function
    End If
End Function
%>